package com.gxa.customer.controller;

import com.gxa.common.pojo.Emailpojo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Slf4j
@RequestMapping("/ttl")
@RestController
public class SendMsgController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping("/sendMsg")
    public void sendMsg(Emailpojo emailpojo) {
        emailpojo = new Emailpojo("3351357339@qq.com", "邮箱主题", "邮箱内容");
        log.info("当前时间：{},发送一条信息给两个 TTL 队列:{}", new Date(), emailpojo);
        rabbitTemplate.convertAndSend("X", "XA",  emailpojo);
//        String message ="测试字符串";
//        rabbitTemplate.convertAndSend("X", "XB", "消息来自 ttl 为 40S 的队列: " + message);
    }

}